﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gglset.aspx.cs" Inherits="weikebuluo.web.admin.actives.gglset" %>

<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="谢俊微信" name="Keywords">
    <meta content="谢俊微信" name="Description">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css">

    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js"></script><style type="text/css">.dropdown-submenu:hover>.dropdown-menu{display:none}</style>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js"></script>
    <script type="text/javascript" src="/Scripts/Inside.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.validate.methods.js"></script>
    <title>谢俊微信</title>
<body>  
	
    <div id="main">
        <div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">

                    <div class="box">
                        <div class="box-title">
                            <div class="span2">
                                <h3><i class="icon-edit"></i>奖项设置 </h3>
                            </div>
                            <div style="margin-top: 9px;">概率的基数为1000，比如设置某奖项概率为1，那么该奖项实际出现概率为1/1000;奖品数量和概率都必须是整数。</div>
                        </div>
                        <div class="box-content">
                            <div class="tab-content">
                                <div class="tab-pane  in active" id="rank">
                                    <form action="gglset.aspx" method="post" class="form-horizontal form-validate" novalidate="novalidate">
                                    <%if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                                      { %>
                                      <input type="hidden" name="id" value="<%=Request.QueryString["id"] %>" />
                                      <%} %>
                                        <table id="rank_table" class="table table-bordered table-hover  dataTable">
                                            <thead>
                                                <tr>
                                                    <th>奖项</th>
                                                    <th>数量</th>
                                                    <th>概率</th>
                                                    <th>操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>

                                        </table>
                                        <div>
                                            <input type="hidden" name="action" class="input-mini" value="save">
                                            <button type="button" class="btn" id="addrank">添加</button>
                                            <button type="submit" class="btn btn-primary">保存</button>

                                        </div>
                                    </form>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <script src="/Scripts/Su.common.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var $grade_index = 0; //msg.length获取$grade_index=msg.length
            $("#addrank").click(function () {
                $grade_index++;
                var tmp = '<tr style="height:47px;"> <td> <input style="height:30px;" type="text" name="add[cname][' + $grade_index + ']"  class="input-medium " data-rule-required="true" /></td>'
                  + '  <td> <input style="height:30px;" type="text" name="add[bscore][' + $grade_index + ']" class="input-mini"  data-rule-required="true" data-rule-number="true" />'
                  + '  </td><td><input style="height:30px;" type="text" name="add[escore][' + $grade_index + ']"  class="input-mini" data-rule-required="true" data-rule-number="true" /></td>'
                   + '<td><a href="javascript:;" class="del">删除</a></td> </tr>';
                var trlength = $("#rank_table tr").length;
                if (trlength < 11) {
                    $("#rank_table").append(tmp);
                } else {
                    G.ui.tips.info("最多添加10个等级");
                }
            });
            $("#rank_table .del").live("click", function () {
                $(this).parents("tr").remove();
            });
        });

        $(document).ready(function () {
            var url = "gglset.aspx";
            $.ajax({
                url: url + "?action=bind&id="+getQueryString("id"),
                type: "post",
                success: function (msg) {
                    msg = eval("(" + msg + ")");
                    var str = "";
                    for (var i = 0; i < msg.length; i++) {
                        str += '<tr style="height:47px;"><td><input style="height:30px;" type="text" name="cname[' + msg[i].ggk_id + ']" value="' + msg[i].ggk_award + '" class="input-medium " data-rule-required="true" /></td><td>';
                        str += '<input  style="height:30px;" type="text" name="bscore[' + msg[i].ggk_id + ']" class="input-mini" value="' + msg[i].ggk_num + '" data-rule-required="true" data-rule-number="true" /></td><td>';
                        str += '<input style="height:30px;" type="text" name="escore[' + msg[i].ggk_id + ']" value="' + msg[i].ggk_chance + '" class="input-mini" data-rule-required="true" data-rule-number="true" /></td>';
                        str += '<td><a href="javascript:Delete(' + msg[i].ggk_id + ')" class="del">删除</a></td></tr>';
                    }
                    $("#rank_table").append(str);
                }
            });
        })
        function Delete(ggk_id) {
            G.ui.tips.confirm("确定要删除吗？", "gglset.aspx?action=del&id="+getQueryString("id")+"&ggk_id=" + ggk_id);
        }
    </script>
    

<div id="fallr-overlay"></div></body></html>